<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<!-- <script src="js/jquery.js" type="text/javascript" charset="utf-8"></script> -->
		<script src="js/myinfo.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="css/myinfo.css"/>
		<link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
		<script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
		
	</head>
	<body>
		<div id="myinfo">
			<div class="my">
				<span class="title">我的资料</span>
			</div>
			<div class="layui-upload">
				<button type="button" class="layui-btn" id="upload">上传图片</button>
				<div class="layui-upload-list" style="width: 100px;height: 100px;border: 1px solid #f1f1f1;">
					<img class="layui-upload-img" id="showImg" style="width: 100%;">
				</div>
			</div>
		</div>
		
		<script type="text/javascript">
			layui.use(["upload"], function() {
				var upload = layui.upload;
				//普通图片上传
				var uploadInst = upload.render({
					elem: '#upload',
					url: 'https://httpbin.org/post', //改成您自己的上传接口
					before: function(obj) {
						//预读本地文件示例，不支持ie8
						obj.preview(function(index, file, result) {
							//console.log(index,file,result)
							$('#showImg').attr('src', result); //图片链接（base64）
						});
					},
					done: function(res) {
						
					}
				});
			
			
			})
		</script>
		
	</body>
</html>
